import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lily
 * Date: 2024-09-22
 * Time: 19:23
 */
public class test_3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case
            String string = in.next();

            ArrayList<Character> arrayList=new ArrayList<>();

            char[] chars = string.toCharArray();

            int left=-1,right=0;
            while (right<chars.length){


                if (left==-1||arrayList.get(left)!=chars[right]){
                    arrayList.add(chars[right]);

                    left++;
                }else {
                    arrayList.remove(left);
                    left--;
                }

                right++;
            }

            if (arrayList.isEmpty()){
                System.out.println(0);
            }else {
                for (Character character : arrayList) {
                    System.out.print(character);
                }
            }
        }
    }
}
